<?php defined( '_VALID_MOS' ) or die( include("404.php") );?>
<div id="content-box">
		<div class="border">
			<div class="padding">
				<div id="toolbar-box">
   			<div class="t">
				<div class="t">
					<div class="t"></div>
				</div>
			</div>
			<div class="m">
				<div class="toolbar" id="toolbar">
<table class="toolbar"><tbody><tr>
<td class="button" id="toolbar-save">
<a href="#" onclick="javascript: submitbutton('save')" class="toolbar">
<span class="icon-32-save" title="Lưu và thoát">
</span>
Lưu và thoát
</a>
</td>

<td class="button" id="toolbar-apply">
<a href="#" onclick="javascript: submitbutton('apply')" class="toolbar">
<span class="icon-32-apply" title="Lưu">
</span>
Lưu
</a>
</td>

<td class="button" id="toolbar-cancel">
<a href="#" onclick="javascript: submitbutton('cancel')" class="toolbar">
<span class="icon-32-cancel" title="Hủy">
</span>
Hủy
</a>
</td>

<td class="button" id="toolbar-help">
<a href="#" class="toolbar">
<span class="icon-32-help" title="Trợ giúp">
</span>
Trợ giúp
</a>
</td>

</tr></tbody></table>
</div>
<div class="header icon-48-sections">
logo: <small><small>[ Thêm mới ]</small></small><br>
</div>

				<div class="clr"></div>
			</div>
			<div class="b">
				<div class="b">
					<div class="b"></div>
				</div>
			</div>
  		</div>
   		<div class="clr"></div>
				
		<div id="element-box">
			<div class="t">
		 		<div class="t">
					<div class="t"></div>
		 		</div>
			</div>
			<div class="m">
		<script type="text/javascript" src="../freeeditor/editor/ckfinder/ckfinder.js"></script>
		<script language="javascript" type="text/javascript">
		function submitbutton(pressbutton) {
			var form = document.phpForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}
			submitform(pressbutton);
		}
		function BrowseServer() {
			/*CKFinder.Popup( '../freeeditor/editor/ckfinder/', null, null, SetFileField ) ;*/
			var finder = new CKFinder() ;
			finder.BasePath = '../freeeditor/editor/ckfinder/' ;
			finder.StartupPath  = "Ads_logo:/ads_logo/"
			finder.SelectFunction = SetFileField ;						
			finder.Popup() ;
		}
		
		function SetFileField( fileUrl ) {
			document.getElementById( 'id_name' ).value = fileUrl ;
			document.getElementById( 'id_id' ).value = fileUrl ;
		}

		</script>

		<form method="post" name="phpForm">

<?php include("../protected/dbconnect.php");
$sql = "SELECT `logo`.`Id`, `logo`.`group_logoID`, `logo`.`file_path`, `logo`.`link`, Date_FORMAT(`logo`.`date_add`, '%d/%m/%Y') As `date_add`, `logo`.`activated`
		FROM `logo`
		WHERE `logo`.`Id` = ?";
$cmd = $mysqli->prepare($sql);
$cmd->bind_param("s", $_GET["id"]);
$cmd->execute();
$cmd->bind_result($Id, $group_logoID, $file_path, $link, $date_add, $activated);
$cmd->store_result();
if($cmd->fetch()){ 
?>

		<div>
			<fieldset class="adminform">
				<legend>Thông tin logo</legend>

				<table class="admintable">
				<tbody><tr>
					<td class="key" width="100">Phạm vi:</td>
					<td colspan="2"><strong>logo </strong></td>
				</tr>
				<tr>
					<td class="key" nowrap="nowrap">
						<label for="grouplogo">Chọn nhóm logo: </label>
					</td>
					<td colspan="2">
						<SELECT class=inputbox size=1 name=groupid>
						  <?php
							include("../protected/dbconnect.php");
							$sql = "SELECT `group_logo`.`Id`, `group_logo`.`description` FROM `group_logo`";
							$cmd = $mysqli->prepare($sql);
							$cmd->execute();
							$cmd->bind_result($subgroup_logoid, $description);
							while($cmd->fetch()){
								if($subgroup_logoid == $group_logoID){
									echo "<option selected value=$subgroup_logoid>$description</option>";
								} else {
									echo "<option value=$subgroup_logoid>$description</option>";
								}
							}
						  ?>
						</SELECT>
					</td>
				</tr>
				<tr>
					<td class="key">
					<label for="title">Hình ảnh:</label></td>
					<td colspan="2">
						<div style="float: left;">
						<input style="background: #ffffff;" type="text" id="id_name" name="id_name" value="<?php echo $file_path; ?>" disabled="disabled" size="35" />
						</div>
						<div class="button2-left">
							<div class="blank">
							<!--<a class="modal" title="Chọn một bài viết"  href=".?com=com_upload&view=upload&path=ads_logo" rel="{handler: 'iframe', size: {x: 750, y: 550}}">Lựa chọn</a>-->
							<a title="Chọn một bài viết"  href="javascript:void(0)" onClick="javascript:BrowseServer();">Lựa chọn</a>
							</div>
						</div>
						<input type="hidden" id="id_id" name="image_file" value="<?php echo $file_path; ?>" />
					</td>
				</tr>
				<tr>
					<td class="key" nowrap="nowrap">
						<label for="link">
							Liên kết:
						</label>
					</td>
					<td colspan="2">
						<input class="text_area" name="link" id="link" value="<?php echo $link; ?>" size="50" maxlength="255" title="Liên kết của logo" type="text">
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="date_add">
							Ngày thêm logo: 
						</label>
					</td>
					<td colspan="2">
						<input class="text_area" name="date_add" id="date_add" value="<?php echo $date_add?>" size="15" maxlength="255" title="ngày logo được thêm" type="text" readonly="true">
						<a onclick="javascript:popUpCalendar(this, date_add, 'dd/mm/yyyy')"><img src="calendar/images/calendar.gif" width="20" height="20"></a>
					</td>
				</tr>
				<tr>
					<td class="key">
						Đã được bật: 
					</td>
					<td colspan="2">
					<?php if($activated == 1){ ?>
						<input name="published" id="published0" value="0" class="inputbox" type="radio">
						<label for="published0">Không</label>
						<input name="published" id="published1" value="1" checked="checked" class="inputbox" type="radio">
						<label for="published1">Yes</label>
					<?php } else { ?>
						<input name="published" id="published0" value="0" checked="checked" class="inputbox" type="radio">
						<label for="published0">Không</label>
						<input name="published" id="published1" value="1" class="inputbox" type="radio">
						<label for="published1">Yes</label>
					<?php } ?>
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="ordering">
							Thứ tự:
						</label>
					</td>
					<td colspan="2">
						Mặc định các chủ mới ở vị trí trên cùng. Thứ tự có thể thay đổi sau khi chủ đề này được lưu.
					</td>
				</tr>
				</tbody>
			</table>
			</fieldset>
		</div>
		<div class="clr"></div>

		<input type="hidden" name="hidden" value="submit_com_logo_logo_edit" />
		<input type="hidden" name="Id" value="<?php echo $Id?>" />
		<input type="hidden" name="task"/>

<?php } ?>

		</form>
		
				<div class="clr"></div>
			</div>
			<div class="b">
				<div class="b">
					<div class="b"></div>
				</div>
			</div>
   		</div>
		<noscript>
			!Cảnh báo! Javascript phải được bật để chạy được các chức năng trong phần Quản trị
		</noscript>
		<div class="clr"></div>
	</div>
	<div class="clr"></div>
</div>
</div>
	<div id="border-bottom"><div><div></div></div></div>